package com.zhongfl.crm.service.boss;

import com.github.pagehelper.PageInfo;
import com.zhongfl.crm.enums.boss.WorkOrderSettleStatus;
import com.zhongfl.crm.model.boss.*;

import java.util.List;

/**
 * @author wang.yuchuan
 * @date 2018/5/7
 */
public interface WorkOrderSettleService {

    /**
     * 保存结算单
     *
     * @param workOrderSettle
     * @param redo 是否是修改结算
     */
    void save(WorkOrderSettle workOrderSettle, boolean redo);

    /**
     * 修改结算或重新发起结算
     *
     * @param workOrderSettle
     */
    void update(WorkOrderSettle workOrderSettle);

    /**
     * 结算确认
     *
     * @param settleNo
     * @param staffCode
     * @param staffName
     */
    void confirm(String settleNo, String remark, String staffCode, String staffName);

    /**
     * 获取工单结算时的甲方乙方人员信息
     *
     * @param workOrderNo
     * @return
     */
    WorkOrderSettleStaffs findSettleStaffsByWorkOrderNo(String workOrderNo);


    /**
     * 获取工单的结算单信息
     *
     * @param workOrderNo
     * @return
     */
    WorkOrderSettle findByWorkOrderNo(String workOrderNo);

    /**
     * 分页查询
     *
     * @param queryInfo
     * @return
     */
    PageInfo<WorkOrderSettleConfirmResult> findByPage(WorkOrderSettleQuery queryInfo);

    /**
     * 根据指定结算单号的结算单信息
     *
     * @param settleNo
     * @return
     */
    WorkOrderSettle findBySettleNo(String settleNo);

    /**
     * 根据订单号查询所有工单 结算单记录
     */
    List<WorkOrderSettle> findByOrderNo(String orderNo);

    List<WorkOrderSettle> findByFromAmibaId(Integer id);

    List<WorkOrderSettle> findByToAmibaId(Integer id);

    void updateCreditParty(WorkOrderSettle workOrderSettle);

    List<WorkOrderSettleConfirm> findConfirmsBySettleNo(String settleNo);

    List<WorkOrderSettleConfirm> findConfirmsBySettleNos(List<String> settleNos);

    List<WorkOrderSettle> findAll(WorkOrderSettleStatus workOrderSettleStatus);

    /**
     * 评分工单查询
     */
    List<WorkOrderSettle> findGradeByOrderNo(String orderNo);

    int findUnGradeOrderCount(String salerCode);

    /**
     * 查询交付经理所受理的已评价订单数量
     * @param staffCode
     * @return
     */
    Integer findMyEvaluatedOrderCount(String staffCode);
}
